3.102 \(\int \frac {1}{1+x^2+2 x \cos (\frac {\pi }{7})} \, dx\)

Optimal. Leaf size=23 \[ \csc \left (\frac {\pi }{7}\right ) \tan ^{-1}\left (x \csc \left (\frac {\pi }{7}\right )+\cot \left (\frac {\pi }{7}\right )\right ) \]

[Out]

arctan(cot(1/7*Pi)+x*csc(1/7*Pi))*csc(1/7*Pi)

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {618, 204} \[ \csc \left (\frac {\pi }{7}\right ) \tan ^{-1}\left (\csc \left (\frac {\pi }{7}\right ) \left (x+\cos \left (\frac {\pi }{7}\right )\right )\right ) \]

Antiderivative was successfully verified.

[In]

Int[(1 + x^2 + 2*x*Cos[Pi/7])^(-1),x]

[Out]

ArcTan[(x + Cos[Pi/7])*Csc[Pi/7]]*Csc[Pi/7]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rubi steps

\begin {align*} \int \frac {1}{1+x^2+2 x \cos \left (\frac {\pi }{7}\right )} \, dx &=-\left (2 \operatorname {Subst}\left (\int \frac {1}{-x^2-4 \sin ^2\left (\frac {\pi }{7}\right )} \, dx,x,2 x+2 \cos \left (\frac {\pi }{7}\right )\right )\right )\\ &=\tan ^{-1}\left (\left (x+\cos \left (\frac {\pi }{7}\right )\right ) \csc \left (\frac {\pi }{7}\right )\right ) \csc \left (\frac {\pi }{7}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 0.04, size = 56, normalized size = 2.43 \[ \frac {2 \tan ^{-1}\left (\frac {2 x-(-1)^{6/7}+\sqrt [7]{-1}}{\sqrt {2-(-1)^{2/7}+(-1)^{5/7}}}\right )}{\sqrt {2-(-1)^{2/7}+(-1)^{5/7}}} \]

Warning: Unable to verify antiderivative.

[In]

Integrate[(1 + x^2 + 2*x*Cos[Pi/7])^(-1),x]

[Out]

(2*ArcTan[((-1)^(1/7) - (-1)^(6/7) + 2*x)/Sqrt[2 - (-1)^(2/7) + (-1)^(5/7)]])/Sqrt[2 - (-1)^(2/7) + (-1)^(5/7)
]

________________________________________________________________________________________

fricas [A]  time = 0.87, size = 21, normalized size = 0.91 \[ \frac {\arctan \left (\frac {x + \cos \left (\frac {1}{7} \, \pi \right )}{\sin \left (\frac {1}{7} \, \pi \right )}\right )}{\sin \left (\frac {1}{7} \, \pi \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="fricas")

[Out]

arctan((x + cos(1/7*pi))/sin(1/7*pi))/sin(1/7*pi)

________________________________________________________________________________________

giac [A]  time = 0.47, size = 33, normalized size = 1.43 \[ \frac {\arctan \left (\frac {x + \cos \left (\frac {1}{7} \, \pi \right )}{\sqrt {-\cos \left (\frac {1}{7} \, \pi \right )^{2} + 1}}\right )}{\sqrt {-\cos \left (\frac {1}{7} \, \pi \right )^{2} + 1}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="giac")

[Out]

arctan((x + cos(1/7*pi))/sqrt(-cos(1/7*pi)^2 + 1))/sqrt(-cos(1/7*pi)^2 + 1)

________________________________________________________________________________________

maple [B]  time = 0.20, size = 39, normalized size = 1.70 \[ \frac {\arctan \left (\frac {2 x +2 \cos \left (\frac {\pi }{7}\right )}{2 \sqrt {1-\left (\cos ^{2}\left (\frac {\pi }{7}\right )\right )}}\right )}{\sqrt {1-\left (\cos ^{2}\left (\frac {\pi }{7}\right )\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(1+x^2+2*x*cos(1/7*Pi)),x)

[Out]

1/(1-cos(1/7*Pi)^2)^(1/2)*arctan(1/2*(2*x+2*cos(1/7*Pi))/(1-cos(1/7*Pi)^2)^(1/2))

________________________________________________________________________________________

maxima [A]  time = 3.02, size = 33, normalized size = 1.43 \[ \frac {\arctan \left (\frac {x + \cos \left (\frac {1}{7} \, \pi \right )}{\sqrt {-\cos \left (\frac {1}{7} \, \pi \right )^{2} + 1}}\right )}{\sqrt {-\cos \left (\frac {1}{7} \, \pi \right )^{2} + 1}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="maxima")

[Out]

arctan((x + cos(1/7*pi))/sqrt(-cos(1/7*pi)^2 + 1))/sqrt(-cos(1/7*pi)^2 + 1)

________________________________________________________________________________________

mupad [B]  time = 0.30, size = 42, normalized size = 1.83 \[ -\frac {\mathrm {atanh}\left (\frac {x+\cos \left (\frac {\Pi }{7}\right )}{\sqrt {\cos \left (\frac {\Pi }{7}\right )-1}\,\sqrt {\cos \left (\frac {\Pi }{7}\right )+1}}\right )}{\sqrt {\cos \left (\frac {\Pi }{7}\right )-1}\,\sqrt {\cos \left (\frac {\Pi }{7}\right )+1}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(x^2 + 2*x*cos(Pi/7) + 1),x)

[Out]

-atanh((x + cos(Pi/7))/((cos(Pi/7) - 1)^(1/2)*(cos(Pi/7) + 1)^(1/2)))/((cos(Pi/7) - 1)^(1/2)*(cos(Pi/7) + 1)^(
1/2))

________________________________________________________________________________________

sympy [C]  time = 0.59, size = 70, normalized size = 3.04 \[ - \frac {i \log {\left (x + \cos {\left (\frac {\pi }{7} \right )} - \frac {i \left (2 - 2 \cos ^{2}{\left (\frac {\pi }{7} \right )}\right )}{2 \sin {\left (\frac {\pi }{7} \right )}} \right )}}{2 \sin {\left (\frac {\pi }{7} \right )}} + \frac {i \log {\left (x + \cos {\left (\frac {\pi }{7} \right )} + \frac {i \left (2 - 2 \cos ^{2}{\left (\frac {\pi }{7} \right )}\right )}{2 \sin {\left (\frac {\pi }{7} \right )}} \right )}}{2 \sin {\left (\frac {\pi }{7} \right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x**2+2*x*cos(1/7*pi)),x)

[Out]

-I*log(x + cos(pi/7) - I*(2 - 2*cos(pi/7)**2)/(2*sin(pi/7)))/(2*sin(pi/7)) + I*log(x + cos(pi/7) + I*(2 - 2*co
s(pi/7)**2)/(2*sin(pi/7)))/(2*sin(pi/7))

________________________________________________________________________________________